function jBox(type,options){this.options={id:null,width:"auto",height:"auto",minWidth:null,maxHeight:null,minWidth:null,maxHeight:null,attach:null,trigger:"click",preventDefault:!1,title:null,content:null,getTitle:null,getContent:null,ajax:{url:null,data:"",reload:!1,getData:"data-ajax",setContent:!0,spinner:!0},target:null,position:{x:"center",y:"center"},outside:null,offset:0,attributes:{x:"left",y:"top"},adjustPosition:!1,adjustTracker:!1,adjustDistance:5,fixed:!1,reposition:!1,repositionOnOpen:!0,repositionOnContent:!0,pointer:!1,pointTo:"target",fade:180,animation:null,theme:"Default",addClass:"",overlay:!1,zIndex:1e4,delayOpen:0,delayClose:0,closeOnEsc:!1,closeOnClick:!1,closeOnMouseleave:!1,closeButton:!1,constructOnInit:!1,blockScroll:!1,appendTo:jQuery("body"),draggable:null,dragOver:!0,onInit:function(){},onCreated:function(){},onOpen:function(){},onClose:function(){},onCloseComplete:function(){},confirmButton:"Submit",cancelButton:"Cancel",confirm:null,cancel:null,autoClose:7e3,color:null,stack:!0,audio:!1,volume:100,src:"href",gallery:"data-jbox-image",imageLabel:"title",imageFade:600,imageSize:"contain"},this.defaultOptions={Tooltip:{getContent:"title",trigger:"mouseenter",position:{x:"center",y:"top"},outside:"y",pointer:!0,adjustPosition:!0,reposition:!0},Mouse:{target:"mouse",position:{x:"right",y:"bottom"},offset:15,trigger:"mouseenter",adjustPosition:"flip"},Modal:{target:jQuery(window),fixed:!0,blockScroll:!0,closeOnEsc:!0,closeOnClick:"overlay",closeButton:!0,overlay:!0,animation:"zoomOut"},Confirm:{target:jQuery(window),fixed:!0,attach:jQuery("[data-confirm]"),getContent:"data-confirm",content:"Do you really want to do this?",minWidth:320,maxWidth:460,blockScroll:!0,closeOnEsc:!0,closeOnClick:"overlay",closeButton:!0,overlay:!0,animation:"zoomOut",preventDefault:!0,_onAttach:function(t){if(!this.options.confirm){var i=t.attr("onclick")?t.attr("onclick"):t.attr("href")?t.attr("target")?'window.open("'+t.attr("href")+'", "'+t.attr("target")+'");':'window.location.href="'+t.attr("href")+'";':"";t.prop("onclick",null).data("jBox-Confirm-submit",i)}},_onCreated:function(){this.footer=jQuery('
'),jQuery('
').html(this.options.cancelButton).click(function(){this.options.cancel&&this.options.cancel(),this.close()}.bind(this)).appendTo(this.footer),this.submitButton=jQuery('
').html(this.options.confirmButton).appendTo(this.footer),this.footer.appendTo(this.container)},_onOpen:function(){this.submitButton.off("click.jBox-Confirm"+this.id).on("click.jBox-Confirm"+this.id,function(){this.options.confirm?this.options.confirm():eval(this.source.data("jBox-Confirm-submit")),this.close()}.bind(this))}},Notice:{target:jQuery(window),fixed:!0,position:{x:20,y:20},attributes:{x:"right",y:"top"},animation:"zoomIn",closeOnClick:"box",_onInit:function(){this.open(),this.options.delayClose=this.options.autoClose,this.options.delayClose&&this.close()},_onCreated:function(){this.options.color&&this.wrapper.addClass("jBox-Notice-color jBox-Notice-"+this.options.color),this.wrapper.data("jBox-Notice-position",this.options.attributes.x+"-"+this.options.attributes.y)},_onOpen:function(){jQuery.each(jQuery(".jBox-Notice"),function(t,i){return i=jQuery(i),i.attr("id")!=this.id&&i.data("jBox-Notice-position")==this.options.attributes.x+"-"+this.options.attributes.y?this.options.stack?void i.css("margin-"+this.options.attributes.y,parseInt(i.css("margin-"+this.options.attributes.y))+this.wrapper.outerHeight()+10):void i.data("jBox").close({ignoreDelay:!0}):void 0}.bind(this)),this.options.audio&&this.audio({url:this.options.audio,valume:this.options.volume})},_onCloseComplete:function(){this.destroy()}},Image:{target:jQuery(window),fixed:!0,blockScroll:!0,closeOnEsc:!0,closeOnClick:"overlay",closeButton:!0,overlay:!0,animation:"zoomOut",width:800,height:533,attach:jQuery("[data-jbox-image]"),preventDefault:!0,_onInit:function(){this.images=this.currentImage={},this.imageZIndex=1,this.attachedElements&&jQuery.each(this.attachedElements,function(t,i){if(i=jQuery(i),!i.data("jBox-image-gallery")){var s=i.attr(this.options.gallery)||"default";!this.images[s]&&(this.images[s]=[]),this.images[s].push({src:i.attr(this.options.src),label:i.attr(this.options.imageLabel)||""}),"title"==this.options.imageLabel&&i.removeAttr("title"),i.data("jBox-image-gallery",s),i.data("jBox-image-id",this.images[s].length-1)}}.bind(this));var t=function(t,i,s,o){if(!jQuery("#jBox-image-"+t+"-"+i).length){{var e=jQuery("
",{id:"jBox-image-"+t+"-"+i,"class":"jBox-image-container"}).css({backgroundImage:"url("+this.images[t][i].src+")",backgroundSize:this.options.imageSize,opacity:o?1:0,zIndex:s?0:this.imageZIndex++}).appendTo(this.content);jQuery("
",{id:"jBox-image-label-"+t+"-"+i,"class":"jBox-image-label"+(o?" active":"")}).html(this.images[t][i].label).appendTo(this.imageLabel)}!o&&!s&&e.animate({opacity:1},this.options.imageFade)}}.bind(this),i=function(t,i){jQuery(".jBox-image-label.active").removeClass("active"),jQuery("#jBox-image-label-"+t+"-"+i).addClass("active")};this.showImage=function(s){if("open"!=s){var o=this.currentImage.gallery,e=this.currentImage.id+(1*("prev"==s)?-1:1);e=e>this.images[o].length-1?0:0>e?this.images[o].length-1:e}else{var o=this.source.data("jBox-image-gallery"),e=this.source.data("jBox-image-id");jQuery(".jBox-image-pointer-prev, .jBox-image-pointer-next").css({display:this.images[o].length>1?"block":"none"})}if(this.currentImage={gallery:o,id:e},jQuery("#jBox-image-"+o+"-"+e).length)jQuery("#jBox-image-"+o+"-"+e).css({zIndex:this.imageZIndex++,opacity:0}).animate({opacity:1},"open"==s?0:this.options.imageFade),i(o,e);else{this.wrapper.addClass("jBox-loading");{jQuery(' ').load(function(){t(o,e,!1),i(o,e),this.wrapper.removeClass("jBox-loading")}.bind(this))}}var n=e+1;n=n>this.images[o].length-1?0:0>n?this.images[o].length-1:n,!jQuery("#jBox-image-"+o+"-"+n).length&&jQuery(' ').load(function(){t(o,n,!0)})}},_onCreated:function(){this.imageLabel=jQuery("
",{id:"jBox-image-label"}).appendTo(this.wrapper),this.wrapper.append(jQuery("
",{"class":"jBox-image-pointer-prev",click:function(){this.showImage("prev")}.bind(this)})).append(jQuery("
",{"class":"jBox-image-pointer-next",click:function(){this.showImage("next")}.bind(this)}))},_onOpen:function(){jQuery("body").addClass("jBox-image-open"),jQuery(document).on("keyup.jBox-"+this.id,function(t){37==t.keyCode&&this.showImage("prev"),39==t.keyCode&&this.showImage("next")}.bind(this)),this.showImage("open")},_onClose:function(){jQuery("body").removeClass("jBox-image-open"),jQuery(document).off("keyup.jBox-"+this.id)},_onCloseComplete:function(){this.wrapper.find(".jBox-image-container").css("opacity",0)}}},"string"==jQuery.type(type)&&(this.type=type,type=this.defaultOptions[type]),this.options=jQuery.extend(!0,this.options,type,options),null===this.options.id&&(this.options.id="jBoxID"+jBox._getUniqueID()),this.id=this.options.id,("center"==this.options.position.x&&"x"==this.options.outside||"center"==this.options.position.y&&"y"==this.options.outside)&&(this.options.outside=!1),(!this.options.outside||"xy"==this.options.outside)&&(this.options.pointer=!1),"object"!=jQuery.type(this.options.offset)&&(this.options.offset={x:this.options.offset,y:this.options.offset}),this.options.offset.x||(this.options.offset.x=0),this.options.offset.y||(this.options.offset.y=0),this.options.adjustDistance="object"!=jQuery.type(this.options.adjustDistance)?{top:this.options.adjustDistance,right:this.options.adjustDistance,bottom:this.options.adjustDistance,left:this.options.adjustDistance}:jQuery.extend({top:5,left:5,right:5,bottom:5},this.options.adjustDistance),this.align=this.options.outside&&"xy"!=this.options.outside?this.options.position[this.options.outside]:"center"!=this.options.position.y&&"number"!=jQuery.type(this.options.position.y)?this.options.position.x:"center"!=this.options.position.x&&"number"!=jQuery.type(this.options.position.x)?this.options.position.y:this.options.attributes.x,this.options.outside&&"xy"!=this.options.outside&&(this.outside=this.options.position[this.options.outside]);var userAgent=navigator.userAgent.toLowerCase();return this.IE8=-1!=userAgent.indexOf("msie")&&8==parseInt(userAgent.split("msie")[1]),this.prefix=-1!=userAgent.indexOf("webkit")?"-webkit-":"",this._getOpp=function(t){return{left:"right",right:"left",top:"bottom",bottom:"top",x:"y",y:"x"}[t]},this._getXY=function(t){return{left:"x",right:"x",top:"y",bottom:"y",center:"x"}[t]},this._getTL=function(t){return{left:"left",right:"left",top:"top",bottom:"top",center:"left",x:"left",y:"top"}[t]},this._supportsSVG=function(){return document.createElement("svg").getAttributeNS},this._createSVG=function(t,i){var s=document.createElementNS("http://www.w3.org/2000/svg",t);return jQuery.each(i,function(t,i){s.setAttribute(i[0],i[1]||"")}),s},this._appendSVG=function(t,i){return i.appendChild(t)},this._create=function(){if(!this.wrapper){if(this.wrapper=jQuery("
",{id:this.id,"class":"jBox-wrapper"+(this.type?" jBox-"+this.type:"")+(this.options.theme?" jBox-"+this.options.theme:"")+(this.options.addClass?" "+this.options.addClass:"")+(this.IE8?" jBox-IE8":"")}).css({position:this.options.fixed?"fixed":"absolute",display:"none",opacity:0,zIndex:this.options.zIndex}).data("jBox",this),this.options.closeOnMouseleave&&this.wrapper.mouseleave(function(t){!this.source||!(t.relatedTarget==this.source[0]||-1!==jQuery.inArray(this.source[0],jQuery(t.relatedTarget).parents("*")))&&this.close()}.bind(this)),"box"==this.options.closeOnClick&&this.wrapper.on("touchend click",function(){this.close({ignoreDelay:!0})}.bind(this)),this.container=jQuery("
",{"class":"jBox-container"}).appendTo(this.wrapper),this.content=jQuery("
",{"class":"jBox-content"}).css({width:this.options.width,height:this.options.height,minWidth:this.options.minWidth,minHeight:this.options.minHeight,maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight}).appendTo(this.container),this.options.closeButton){if(this.closeButton=jQuery("
",{"class":"jBox-closeButton jBox-noDrag"}).on("touchend click",function(){this.isOpen&&this.close({ignoreDelay:!0})}.bind(this)),this._supportsSVG()){var t=this._createSVG("svg",[["viewBox","0 0 24 24"]]);this._appendSVG(this._createSVG("path",[["d","M22.2,4c0,0,0.5,0.6,0,1.1l-6.8,6.8l6.9,6.9c0.5,0.5,0,1.1,0,1.1L20,22.3c0,0-0.6,0.5-1.1,0L12,15.4l-6.9,6.9c-0.5,0.5-1.1,0-1.1,0L1.7,20c0,0-0.5-0.6,0-1.1L8.6,12L1.7,5.1C1.2,4.6,1.7,4,1.7,4L4,1.7c0,0,0.6-0.5,1.1,0L12,8.5l6.8-6.8c0.5-0.5,1.1,0,1.1,0L22.2,4z"]]),t),this.closeButton.append(t)}else this.wrapper.addClass("jBox-nosvg");("box"==this.options.closeButton||this.options.closeButton===!0&&!this.options.overlay&&!this.options.title)&&(this.wrapper.addClass("jBox-closeButton-box"),this.closeButton.appendTo(this.container))}if(this.wrapper.appendTo(this.options.appendTo),this.options.pointer){if(this.pointer={position:"target"!=this.options.pointTo?this.options.pointTo:this._getOpp(this.outside),xy:this._getXY("target"!=this.options.pointTo?this.options.pointTo:this.outside),align:"center",offset:0},this.pointer.element=jQuery("
",{"class":"jBox-pointer jBox-pointer-"+this.pointer.position}).appendTo(this.wrapper),this.pointer.dimensions={x:this.pointer.element.outerWidth(),y:this.pointer.element.outerHeight()},"string"==jQuery.type(this.options.pointer)){var i=this.options.pointer.split(":");i[0]&&(this.pointer.align=i[0]),i[1]&&(this.pointer.offset=parseInt(i[1]))}this.pointer.alignAttribute="x"==this.pointer.xy?"bottom"==this.pointer.align?"bottom":"top":"right"==this.pointer.align?"right":"left",this.wrapper.css("padding-"+this.pointer.position,this.pointer.dimensions[this.pointer.xy]),this.pointer.element.css(this.pointer.alignAttribute,"center"==this.pointer.align?"50%":0).css("margin-"+this.pointer.alignAttribute,this.pointer.offset),this.pointer.margin={},this.pointer.margin["margin-"+this.pointer.alignAttribute]=this.pointer.offset,"center"==this.pointer.align&&this.pointer.element.css(this.prefix+"transform","translate("+("y"==this.pointer.xy?this.pointer.dimensions.x*-.5+"px":0)+", "+("x"==this.pointer.xy?this.pointer.dimensions.y*-.5+"px":0)+")"),this.pointer.element.css("x"==this.pointer.xy?"width":"height",parseInt(this.pointer.dimensions[this.pointer.xy])+parseInt(this.container.css("border-"+this.pointer.alignAttribute+"-width"))),this.wrapper.addClass("jBox-pointerPosition-"+this.pointer.position)}if(this.setContent(this.options.content,!0),this.setTitle(this.options.title,!0),this.options.draggable){var s="title"==this.options.draggable?this.titleContainer:this.options.draggable.length>0?this.options.draggable:this.options.draggable.selector?jQuery(this.options.draggable.selector):this.wrapper;s.addClass("jBox-draggable").on("mousedown",function(t){if(2!=t.button&&!jQuery(t.target).hasClass("jBox-noDrag")&&!jQuery(t.target).parents(".jBox-noDrag").length){this.options.dragOver&&this.wrapper.css("zIndex")<=jBox.zIndexMax&&(jBox.zIndexMax+=1,this.wrapper.css("zIndex",jBox.zIndexMax));var i=this.wrapper.outerHeight(),s=this.wrapper.outerWidth(),o=this.wrapper.offset().top+i-t.pageY,e=this.wrapper.offset().left+s-t.pageX;jQuery(document).on("mousemove.jBox-draggable-"+this.id,function(t){this.wrapper.offset({top:t.pageY+o-i,left:t.pageX+e-s})}.bind(this)),t.preventDefault()}}.bind(this)).on("mouseup",function(){jQuery(document).off("mousemove.jBox-draggable-"+this.id)}.bind(this)),jBox.zIndexMax=jBox.zIndexMax?Math.max(jBox.zIndexMax,this.options.zIndex):this.options.zIndex}this.options.onCreated.bind(this)(),this.options._onCreated&&this.options._onCreated.bind(this)()}},this.options.constructOnInit&&this._create(),this.options.attach&&this.attach(),this._positionMouse=function(t){this.pos={left:t.pageX,top:t.pageY};var i=function(t,i){return"center"==this.options.position[i]?void(this.pos[t]-=Math.ceil(this.dimensions[i]/2)):(this.pos[t]+=t==this.options.position[i]?-1*this.dimensions[i]-this.options.offset[i]:this.options.offset[i],this.pos[t])}.bind(this);this.wrapper.css({left:i("left","x"),top:i("top","y")}),this.targetDimensions={x:0,y:0,left:t.pageX,top:t.pageY},this._adjustPosition()},this._attachEvents=function(){if(this.options.closeOnEsc&&jQuery(document).on("keyup.jBox-"+this.id,function(t){27==t.keyCode&&this.close({ignoreDelay:!0})}.bind(this)),(this.options.closeOnClick===!0||"body"==this.options.closeOnClick)&&jQuery(document).on("touchend.jBox-"+this.id+" click.jBox-"+this.id,function(t){this.blockBodyClick||"body"==this.options.closeOnClick&&(t.target==this.wrapper[0]||this.wrapper.has(t.target).length)||this.close({ignoreDelay:!0})}.bind(this)),(this.options.adjustPosition&&this.options.adjustTracker||this.options.reposition)&&!this.fixed&&this.outside){var t,i=0,s=150,o=function(){var o=(new Date).getTime();t||(o-i>s&&(this.options.reposition&&this.position(),this.options.adjustTracker&&this._adjustPosition(),i=o),t=setTimeout(function(){t=null,i=(new Date).getTime(),this.options.reposition&&this.position(),this.options.adjustTracker&&this._adjustPosition()}.bind(this),s))}.bind(this);this.options.adjustTracker&&"resize"!=this.options.adjustTracker&&jQuery(window).on("scroll.jBox-"+this.id,function(){o()}.bind(this)),(this.options.adjustTracker&&"scroll"!=this.options.adjustTracker||this.options.reposition)&&jQuery(window).on("resize.jBox-"+this.id,function(){o()}.bind(this))}"mouse"==this.options.target&&jQuery("body").on("mousemove.jBox-"+this.id,function(t){this._positionMouse(t)}.bind(this))},this._detachEvents=function(){this.options.closeOnEsc&&jQuery(document).off("keyup.jBox-"+this.id),(this.options.closeOnClick===!0||"body"==this.options.closeOnClick)&&jQuery(document).off("touchend.jBox-"+this.id+" click.jBox-"+this.id),(this.options.adjustPosition&&this.options.adjustTracker||this.options.reposition)&&(jQuery(window).off("scroll.jBox-"+this.id),jQuery(window).off("resize.jBox-"+this.id)),"mouse"==this.options.target&&jQuery("body").off("mousemove.jBox-"+this.id)},this._addOverlay=function(){this.overlay||(this.overlay=jQuery("#jBox-overlay").length?jQuery("#jBox-overlay").css({zIndex:Math.min(jQuery("#jBox-overlay").css("z-index"),this.options.zIndex-1)}):jQuery("
",{id:"jBox-overlay"}).css({display:"none",opacity:0,zIndex:this.options.zIndex-1}).appendTo(jQuery("body")),("overlay"==this.options.closeButton||this.options.closeButton===!0)&&(jQuery("#jBox-overlay .jBox-closeButton").length>0?jQuery("#jBox-overlay .jBox-closeButton").on("touchend click",function(){this.isOpen&&this.close({ignoreDelay:!0})}.bind(this)):this.overlay.append(this.closeButton)),"overlay"==this.options.closeOnClick&&this.overlay.on("touchend click",function(){this.isOpen&&this.close({ignoreDelay:!0})}.bind(this)));var t=this.overlay.data("jBox")||{};t["jBox-"+this.id]=!0,this.overlay.data("jBox",t),"block"!=this.overlay.css("display")&&(this.options.fade?this.overlay.stop()&&this.overlay.animate({opacity:1},{queue:!1,duration:this.options.fade,start:function(){this.overlay.css({display:"block"})}.bind(this)}):this.overlay.css({display:"block",opacity:1}))},this._removeOverlay=function(){if(this.overlay){var t=this.overlay.data("jBox");delete t["jBox-"+this.id],this.overlay.data("jBox",t),jQuery.isEmptyObject(t)&&(this.options.fade?this.overlay.stop()&&this.overlay.animate({opacity:0},{queue:!1,duration:this.options.fade,complete:function(){this.overlay.css({display:"none"})}.bind(this)}):this.overlay.css({display:"none",opacity:0}))}},this._generateCSS=function(){if(!this.IE8){"object"!=jQuery.type(this.options.animation)&&(this.options.animation={pulse:{open:"pulse",close:"zoomOut"},zoomIn:{open:"zoomIn",close:"zoomIn"},zoomOut:{open:"zoomOut",close:"zoomOut"},move:{open:"move",close:"move"},slide:{open:"slide",close:"slide"},flip:{open:"flip",close:"flip"},tada:{open:"tada",close:"zoomOut"}}[this.options.animation]),this.options.animation.open&&(this.options.animation.open=this.options.animation.open.split(":")),this.options.animation.close&&(this.options.animation.close=this.options.animation.close.split(":")),this.options.animation.openDirection=this.options.animation.open?this.options.animation.open[1]:null,this.options.animation.closeDirection=this.options.animation.close?this.options.animation.close[1]:null,this.options.animation.open&&(this.options.animation.open=this.options.animation.open[0]),this.options.animation.close&&(this.options.animation.close=this.options.animation.close[0]),this.options.animation.open&&(this.options.animation.open+="Open"),this.options.animation.close&&(this.options.animation.close+="Close");var t={pulse:{duration:350,css:[["0%","scale(1)"],["50%","scale(1.1)"],["100%","scale(1)"]]},zoomInOpen:{duration:this.options.fade||180,css:[["0%","scale(0.9)"],["100%","scale(1)"]]},zoomInClose:{duration:this.options.fade||180,css:[["0%","scale(1)"],["100%","scale(0.9)"]]},zoomOutOpen:{duration:this.options.fade||180,css:[["0%","scale(1.1)"],["100%","scale(1)"]]},zoomOutClose:{duration:this.options.fade||180,css:[["0%","scale(1)"],["100%","scale(1.1)"]]},moveOpen:{duration:this.options.fade||180,positions:{top:{"0%":-12},right:{"0%":12},bottom:{"0%":12},left:{"0%":-12}},css:[["0%","translate%XY(%Vpx)"],["100%","translate%XY(0px)"]]},moveClose:{duration:this.options.fade||180,timing:"ease-in",positions:{top:{"100%":-12},right:{"100%":12},bottom:{"100%":12},left:{"100%":-12}},css:[["0%","translate%XY(0px)"],["100%","translate%XY(%Vpx)"]]},slideOpen:{duration:400,positions:{top:{"0%":-400},right:{"0%":400},bottom:{"0%":400},left:{"0%":-400}},css:[["0%","translate%XY(%Vpx)"],["100%","translate%XY(0px)"]]},slideClose:{duration:400,timing:"ease-in",positions:{top:{"100%":-400},right:{"100%":400},bottom:{"100%":400},left:{"100%":-400}},css:[["0%","translate%XY(0px)"],["100%","translate%XY(%Vpx)"]]},flipOpen:{duration:600,css:[["0%","perspective(400px) rotateX(90deg)"],["40%","perspective(400px) rotateX(-15deg)"],["70%","perspective(400px) rotateX(15deg)"],["100%","perspective(400px) rotateX(0deg)"]]},flipClose:{duration:this.options.fade||300,css:[["0%","perspective(400px) rotateX(0deg)"],["100%","perspective(400px) rotateX(90deg)"]]},tada:{duration:800,css:[["0%","scale(1)"],["10%, 20%","scale(0.9) rotate(-3deg)"],["30%, 50%, 70%, 90%","scale(1.1) rotate(3deg)"],["40%, 60%, 80%","scale(1.1) rotate(-3deg)"],["100%","scale(1) rotate(0)"]]}};jQuery.each(["pulse","tada"],function(i,s){t[s+"Open"]=t[s+"Close"]=t[s]});var i=function(i,s){return keyframe_css="@"+this.prefix+"keyframes jBox-animation-"+this.options.animation[i]+"-"+i+(s?"-"+s:"")+" {",jQuery.each(t[this.options.animation[i]].css,function(o,e){var n=s?e[1].replace("%XY",this._getXY(s).toUpperCase()):e[1];t[this.options.animation[i]].positions&&(n=n.replace("%V",t[this.options.animation[i]].positions[s][e[0]])),keyframe_css+=e[0]+" {"+this.prefix+"transform:"+n+";}"}.bind(this)),keyframe_css+="}",keyframe_css+=".jBox-animation-"+this.options.animation[i]+"-"+i+(s?"-"+s:"")+" {",keyframe_css+=this.prefix+"animation-duration: "+t[this.options.animation[i]].duration+"ms;",keyframe_css+=this.prefix+"animation-name: jBox-animation-"+this.options.animation[i]+"-"+i+(s?"-"+s:"")+";",keyframe_css+=t[this.options.animation[i]].timing?this.prefix+"animation-timing-function: "+t[this.options.animation[i]].timing+";":"",keyframe_css+="}"}.bind(this),s="";jQuery.each(["open","close"],function(o,e){return this.options.animation[e]&&t[this.options.animation[e]]&&("close"!=e||this.options.fade)?void(t[this.options.animation[e]].positions?jQuery.each(["top","right","bottom","left"],function(t,o){s+=i(e,o)}):s+=i(e)):""}.bind(this)),jQuery("").append(s).appendTo(jQuery("head"))}},this._blockBodyClick=function(){this.blockBodyClick=!0,setTimeout(function(){this.blockBodyClick=!1}.bind(this),10)},this.options.animation&&this._generateCSS(),this._animate=function(t){if(!this.IE8){if(t||(t=this.isOpen?"open":"close"),!this.options.fade&&"close"==t)return null;var i=this.options.animation[t+"Direction"]||("center"!=this.align?this.align:this.options.attributes.x);this.flipped&&this._getXY(i)==this._getXY(this.align)&&(i=this._getOpp(i));var s="jBox-animation-"+this.options.animation[t]+"-"+t+" jBox-animation-"+this.options.animation[t]+"-"+t+"-"+i;this.wrapper.addClass(s);var o=1e3*parseFloat(this.wrapper.css(this.prefix+"animation-duration"));"close"==t&&(o=Math.min(o,this.options.fade)),setTimeout(function(){this.wrapper.removeClass(s)}.bind(this),o)}},this._abortAnimation=function(){if(!this.IE8){var t="jBox-animation",i=this.wrapper.attr("class").split(" ").filter(function(i){return 0!==i.lastIndexOf(t,0)});this.wrapper.attr("class",i.join(" "))}},this._adjustPosition=function(){if(!this.options.adjustPosition)return null;this.positionAdjusted&&(this.wrapper.css(this.pos),this.pointer&&this.wrapper.css("padding",0).css("padding-"+this._getOpp(this.outside),this.pointer.dimensions[this._getXY(this.outside)]).removeClass("jBox-pointerPosition-"+this._getOpp(this.pointer.position)).addClass("jBox-pointerPosition-"+this.pointer.position),this.pointer&&this.pointer.element.attr("class","jBox-pointer jBox-pointer-"+this._getOpp(this.outside)).css(this.pointer.margin),this.positionAdjusted=!1,this.flipped=!1);var t=jQuery(window),i={x:t.width(),y:t.height(),top:this.options.fixed&&this.target.data("jBox-fixed")?0:t.scrollTop(),left:this.options.fixed&&this.target.data("jBox-fixed")?0:t.scrollLeft()};i.bottom=i.top+i.y,i.right=i.left+i.x;var s=i.top>this.pos.top-(this.options.adjustDistance.top||0),o=i.rightthis.pos.left-(this.options.adjustDistance.left||0),a=n?"left":o?"right":null,h=s?"top":e?"bottom":null,p=a||h;if(p){"move"==this.options.adjustPosition||a!=this.outside&&h!=this.outside||("mouse"==this.target&&(this.outside="right"),("top"==this.outside||"left"==this.outside?i[this._getXY(this.outside)]-(this.targetDimensions[this._getTL(this.outside)]-i[this._getTL(this.outside)])-this.targetDimensions[this._getXY(this.outside)]+this.options.offset[this._getXY(this.outside)]:this.targetDimensions[this._getTL(this.outside)]-i[this._getTL(this.outside)]-this.options.offset[this._getXY(this.outside)])>this.dimensions[this._getXY(this.outside)]+parseInt(this.options.adjustDistance[this._getOpp(this.outside)])&&(this.wrapper.css(this._getTL(this.outside),this.pos[this._getTL(this.outside)]+(this.dimensions[this._getXY(this.outside)]+this.options.offset[this._getXY(this.outside)]*("top"==this.outside||"left"==this.outside?-2:2)+this.targetDimensions[this._getXY(this.outside)])*("top"==this.outside||"left"==this.outside?1:-1)),this.pointer&&this.wrapper.removeClass("jBox-pointerPosition-"+this.pointer.position).addClass("jBox-pointerPosition-"+this._getOpp(this.pointer.position)).css("padding",0).css("padding-"+this.outside,this.pointer.dimensions[this._getXY(this.outside)]),this.pointer&&this.pointer.element.attr("class","jBox-pointer jBox-pointer-"+this.outside),this.positionAdjusted=!0,this.flipped=!0));var r="x"==this._getXY(this.outside)?h:a;if(this.pointer&&"flip"!=this.options.adjustPosition&&this._getXY(r)==this._getOpp(this._getXY(this.outside))){if("center"==this.pointer.align)var l=this.dimensions[this._getXY(r)]/2-this.pointer.dimensions[this._getOpp(this.pointer.xy)]/2-parseInt(this.pointer.element.css("margin-"+this.pointer.alignAttribute))*(r!=this._getTL(r)?-1:1);else var l=r==this.pointer.alignAttribute?parseInt(this.pointer.element.css("margin-"+this.pointer.alignAttribute)):this.dimensions[this._getXY(r)]-parseInt(this.pointer.element.css("margin-"+this.pointer.alignAttribute))-this.pointer.dimensions[this._getXY(r)];spaceDiff=r==this._getTL(r)?i[this._getTL(r)]-this.pos[this._getTL(r)]+this.options.adjustDistance[r]:-1*(i[this._getOpp(this._getTL(r))]-this.pos[this._getTL(r)]-this.options.adjustDistance[r]-this.dimensions[this._getXY(r)]),r==this._getOpp(this._getTL(r))&&this.pos[this._getTL(r)]-spaceDiff=spaceDiff&&spaceDiff>0&&(this.pointer.element.css("margin-"+this.pointer.alignAttribute,parseInt(this.pointer.element.css("margin-"+this.pointer.alignAttribute))-spaceDiff*(r!=this.pointer.alignAttribute?-1:1)),this.wrapper.css(this._getTL(r),this.pos[this._getTL(r)]+spaceDiff*(r!=this._getTL(r)?-1:1)),this.positionAdjusted=!0)}}},this.options.onInit.bind(this)(),this.options._onInit&&this.options._onInit.bind(this)(),this}jBox.prototype.attach=function(t,i){return t||(t=jQuery(this.options.attach.selector||this.options.attach)),i||(i=this.options.trigger),t&&t.length&&jQuery.each(t,function(t,s){s=jQuery(s),s.data("jBox-attached-"+this.id)||("title"==this.options.getContent&&void 0!=s.attr("title")&&s.data("jBox-getContent",s.attr("title")).removeAttr("title"),this.attachedElements||(this.attachedElements=[]),this.attachedElements.push(s[0]),s.on(i+".jBox-attach-"+this.id,function(t){if(this.timer&&clearTimeout(this.timer),"mouseenter"!=i||!this.isOpen||this.source[0]!=s[0]){if(this.isOpen&&this.source&&this.source[0]!=s[0])var o=!0;this.source=s,!this.options.target&&(this.target=s),"click"==i&&this.options.preventDefault&&t.preventDefault(),this["click"!=i||o?"open":"toggle"]()}}.bind(this)),"mouseenter"==this.options.trigger&&s.on("mouseleave",function(t){(!this.options.closeOnMouseleave||t.relatedTarget!=this.wrapper[0]&&!jQuery(t.relatedTarget).parents("#"+this.id).length)&&this.close()}.bind(this)),s.data("jBox-attached-"+this.id,i),this.options._onAttach&&this.options._onAttach.bind(this)(s))}.bind(this)),this},jBox.prototype.detach=function(t){return t||(t=this.attachedElements||[]),t&&t.length&&jQuery.each(t,function(t,i){i=jQuery(i),i.data("jBox-attached-"+this.id)&&(i.off(i.data("jBox-attached-"+this.id)+".jBox-attach-"+this.id),i.data("jBox-attached-"+this.id,null)),this.attachedElements=jQuery.grep(this.attachedElements,function(t){return t!=i[0]})}.bind(this)),this},jBox.prototype.setTitle=function(t,i){var s=this.wrapper.height(),o=this.wrapper.width();return null==t||void 0==t?this:(!this.wrapper&&this._create(),this.title||(this.titleContainer=jQuery("
",{"class":"jBox-title"}),this.title=jQuery("
").appendTo(this.titleContainer),this.wrapper.addClass("jBox-hasTitle"),("title"==this.options.closeButton||this.options.closeButton===!0&&!this.options.overlay)&&(this.wrapper.addClass("jBox-closeButton-title"),this.closeButton.appendTo(this.titleContainer)),this.titleContainer.insertBefore(this.content)),this.title.html(t),!i&&this.options.repositionOnContent&&(s!=this.wrapper.height()||o!=this.wrapper.width())&&this.position(),this)},jBox.prototype.setContent=function(t,i){if(null==t)return this;!this.wrapper&&this._create();var s=this.wrapper.height(),o=this.wrapper.width(),e=jQuery("body").height(),n=jQuery("body").width();switch(this.content.children("[data-jbox-content-appended]").appendTo("body").css({display:"none"}),jQuery.type(t)){case"string":this.content.html(t);break;case"object":this.content.html(""),t.attr("data-jbox-content-appended",1).appendTo(this.content).css({display:"block"})}var a={x:n-jQuery("body").width(),y:e-jQuery("body").height()};return!i&&this.options.repositionOnContent&&(s!=this.wrapper.height()||o!=this.wrapper.width())&&this.position({adjustOffset:a}),this},jBox.prototype.setDimensions=function(t,i,s){!this.wrapper&&this._create(),this.content.css(t,i),(void 0==s||s)&&this.position()},jBox.prototype.setWidth=function(t,i){this.setDimensions("width",t,i)},jBox.prototype.setHeight=function(t,i){this.setDimensions("height",t,i)},jBox.prototype.position=function(t){if(t||(t={}),this.target=t.target||this.target||this.options.target||jQuery(window),this.dimensions={x:this.wrapper.outerWidth(),y:this.wrapper.outerHeight()},"mouse"!=this.target){if("center"==this.options.position.x&&"center"==this.options.position.y)return this.wrapper.css({left:"50%",top:"50%",marginLeft:this.dimensions.x*-.5+this.options.offset.x,marginTop:this.dimensions.y*-.5+this.options.offset.y}),this;var i=this.target.offset();!this.target.data("jBox-fixed")&&this.target.data("jBox-fixed",this.target[0]==jQuery(window)[0]||"fixed"!=this.target.css("position")&&this.target.parents().filter(function(){return"fixed"==jQuery(this).css("position")}).length<=0?"static":"fixed"),"fixed"==this.target.data("jBox-fixed")&&this.options.fixed&&(i.top=i.top-jQuery(window).scrollTop(),i.left=i.left-jQuery(window).scrollLeft()),this.targetDimensions={x:this.target.outerWidth(),y:this.target.outerHeight(),top:i?i.top:0,left:i?i.left:0},this.pos={};var s=function(t){if(-1==jQuery.inArray(this.options.position[t],["top","right","bottom","left","center"]))return void(this.pos[this.options.attributes[t]]=this.options.position[t]);var i=this.options.attributes[t]="x"==t?"left":"top";return this.pos[i]=this.targetDimensions[i],"center"==this.options.position[t]?void(this.pos[i]+=Math.ceil((this.targetDimensions[t]-this.dimensions[t])/2)):(i!=this.options.position[t]&&(this.pos[i]+=this.targetDimensions[t]-this.dimensions[t]),void((this.options.outside==t||"xy"==this.options.outside)&&(this.pos[i]+=this.dimensions[t]*(i!=this.options.position[t]?1:-1))))}.bind(this);if(s("x"),s("y"),this.options.pointer&&"number"!=jQuery.type(this.options.position.x)&&"number"!=jQuery.type(this.options.position.y)){var o=0;switch(this.pointer.align){case"center":"center"!=this.options.position[this._getOpp(this.options.outside)]&&(o+=this.dimensions[this._getOpp(this.options.outside)]/2);break;default:switch(this.options.position[this._getOpp(this.options.outside)]){case"center":o+=(this.dimensions[this._getOpp(this.options.outside)]/2-this.pointer.dimensions[this._getOpp(this.options.outside)]/2)*(this.pointer.align==this._getTL(this.pointer.align)?1:-1);
break;default:o+=this.pointer.align!=this.options.position[this._getOpp(this.options.outside)]?this.dimensions[this._getOpp(this.options.outside)]*(-1!==jQuery.inArray(this.pointer.align,["top","left"])?1:-1)+this.pointer.dimensions[this._getOpp(this.options.outside)]/2*(-1!==jQuery.inArray(this.pointer.align,["top","left"])?-1:1):this.pointer.dimensions[this._getOpp(this.options.outside)]/2*(-1!==jQuery.inArray(this.pointer.align,["top","left"])?1:-1)}}o*=this.options.position[this._getOpp(this.options.outside)]==this.pointer.alignAttribute?-1:1,o+=this.pointer.offset*(this.pointer.align==this._getOpp(this._getTL(this.pointer.align))?1:-1),this.pos[this._getTL(this._getOpp(this.pointer.xy))]+=o}return t.adjustOffset&&t.adjustOffset.x&&(this.pos[this.options.attributes.x]+=parseInt(t.adjustOffset.x)*("left"==this.options.attributes.x?1:-1)),t.adjustOffset&&t.adjustOffset.y&&(this.pos[this.options.attributes.y]+=parseInt(t.adjustOffset.y)*("top"==this.options.attributes.y?1:-1)),this.pos[this.options.attributes.x]+=this.options.offset.x,this.pos[this.options.attributes.y]+=this.options.offset.y,this.wrapper.css(this.pos),this._adjustPosition(),this}},jBox.prototype.open=function(t){if(t||(t={}),this.isDestroyed)return!1;if(!this.wrapper&&this._create(),this.timer&&clearTimeout(this.timer),this._blockBodyClick(),this.isDisabled)return this;var i=function(){this.source&&this.options.getTitle&&(this.source.attr(this.options.getTitle)&&this.setTitle(this.source.attr(this.options.getTitle)),!0),this.source&&this.options.getContent&&(this.source.data("jBox-getContent")?this.setContent(this.source.data("jBox-getContent"),!0):this.source.attr(this.options.getContent)?this.setContent(this.source.attr(this.options.getContent),!0):null),this.options.onOpen.bind(this)(),this.options._onOpen&&this.options._onOpen.bind(this)(),(this.options.ajax&&this.options.ajax.url&&(!this.ajaxLoaded||this.options.ajax.reload)||t.ajax&&t.ajax.url)&&this.ajax(t.ajax||null),(!this.positionedOnOpen||this.options.repositionOnOpen)&&this.position({target:t.target})&&(this.positionedOnOpen=!0),this.isClosing&&this._abortAnimation(),this.isOpen||(this.isOpen=!0,this._attachEvents(),this.options.blockScroll&&jQuery("body").addClass("jBox-blockScroll-"+this.id),this.options.overlay&&this._addOverlay(),this.options.animation&&!this.isClosing&&this._animate("open"),this.options.fade?this.wrapper.stop().animate({opacity:1},{queue:!1,duration:this.options.fade,start:function(){this.isOpening=!0,this.wrapper.css({display:"block"})}.bind(this),always:function(){this.isOpening=!1}.bind(this)}):this.wrapper.css({display:"block",opacity:1}))}.bind(this);return!this.options.delayOpen||this.isOpen||this.isClosing||t.ignoreDelay?i():this.timer=setTimeout(i,this.options.delayOpen),this},jBox.prototype.close=function(t){if(t||(t={}),this.isDestroyed)return!1;if(this.timer&&clearTimeout(this.timer),this._blockBodyClick(),this.isDisabled)return this;var i=function(){this.options.onClose.bind(this)(),this.options._onClose&&this.options._onClose.bind(this)(),this.isOpen&&(this.isOpen=!1,this._detachEvents(),this.options.blockScroll&&jQuery("body").removeClass("jBox-blockScroll-"+this.id),this.options.overlay&&this._removeOverlay(),this.options.animation&&!this.isOpening&&this._animate("close"),this.options.fade?this.wrapper.stop().animate({opacity:0},{queue:!1,duration:this.options.fade,start:function(){this.isClosing=!0}.bind(this),complete:function(){this.wrapper.css({display:"none"}),this.options.onCloseComplete&&this.options.onCloseComplete.bind(this)(),this.options._onCloseComplete&&this.options._onCloseComplete.bind(this)()}.bind(this),always:function(){this.isClosing=!1}.bind(this)}):(this.wrapper.css({display:"none",opacity:0}),this.options._onCloseComplete&&this.options._onCloseComplete.bind(this)()))}.bind(this);return t.ignoreDelay?i():this.timer=setTimeout(i,Math.max(this.options.delayClose,10)),this},jBox.prototype.toggle=function(t){return this[this.isOpen?"close":"open"](t),this},jBox.prototype.disable=function(){return this.isDisabled=!0,this},jBox.prototype.enable=function(){return this.isDisabled=!1,this},jBox.prototype.ajax=function(t){t||(t={}),this.options.ajax.getData&&!t.data&&this.source&&void 0!=this.source.attr(this.options.ajax.getData)&&(t.data=this.source.attr(this.options.ajax.getData)||"");var i=jQuery.extend(!0,{},this.options.ajax);this.ajaxRequest&&this.ajaxRequest.abort();var s=t.beforeSend||i.beforeSend||function(){},o=t.complete||i.complete||function(){},e=jQuery.extend(!0,i,t);return e.beforeSend=function(){e.spinner&&(this.wrapper.addClass("jBox-loading"),this.spinner=jQuery(e.spinner!==!0?e.spinner:'
').appendTo(this.container)),s.bind(this)()}.bind(this),e.complete=function(t){this.wrapper.removeClass("jBox-loading"),this.spinner&&this.spinner.remove(),e.setContent&&this.setContent(t.responseText),this.ajaxLoaded=!0,o.bind(this)(t)}.bind(this),this.ajaxRequest=jQuery.ajax(e),this},jBox.prototype.audio=function(t){if(t||(t={}),jBox._audio||(jBox._audio={}),!t.url||this.IE8)return this;if(!jBox._audio[t.url]){var i=jQuery(" ");jQuery(" ",{src:t.url+".mp3"}).appendTo(i),jQuery(" ",{src:t.url+".ogg"}).appendTo(i),jBox._audio[t.url]=i[0]}jBox._audio[t.url].volume=Math.min(void 0!=t.volume?t.volume:(void 0!=this.options.volume?this.options.volume:100)/100,1),jBox._audio[t.url].pause();try{jBox._audio[t.url].currentTime=0}catch(s){}return jBox._audio[t.url].play(),this},jBox.prototype.destroy=function(){return this.detach().close({ignoreDelay:!0}),this.wrapper&&this.wrapper.remove(),this.isDestroyed=!0,this},jBox._getUniqueID=function(){var t=1;return function(){return t++}}(),jQuery.fn.jBox=function(t,i){return t||(t={}),i||(i={}),new jBox(t,jQuery.extend(i,{attach:this}))},Function.prototype.bind||(Function.prototype.bind=function(t){var i=Array.prototype.slice.call(arguments,1),s=this,o=function(){},e=function(){return s.apply(this instanceof o&&t?this:t,i.concat(Array.prototype.slice.call(arguments)))};return o.prototype=this.prototype,e.prototype=new o,e});
!function(){var e,t,i;!function(n){function r(e,t){return b.call(e,t)}function o(e,t){var i,n,r,o,a,l,s,d,c,f,u,h=t&&t.split("/"),g=y.map,m=g&&g["*"]||{};if(e&&"."===e.charAt(0))if(t){for(e=e.split("/"),a=e.length-1,y.nodeIdCompat&&_.test(e[a])&&(e[a]=e[a].replace(_,"")),e=h.slice(0,h.length-1).concat(e),c=0;c0&&(e.splice(c-1,2),c-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((h||m)&&g){for(i=e.split("/"),c=i.length;c>0;c-=1){if(n=i.slice(0,c).join("/"),h)for(f=h.length;f>0;f-=1)if((r=g[h.slice(0,f).join("/")])&&(r=r[n])){o=r,l=c;break}if(o)break;!s&&m&&m[n]&&(s=m[n],d=c)}!o&&s&&(o=s,l=d),o&&(i.splice(0,l,o),e=i.join("/"))}return e}function a(e,t){return function(){var i=w.call(arguments,0);return"string"!=typeof i[0]&&1===i.length&&i.push(null),h.apply(n,i.concat([e,t]))}}function l(e){return function(t){return o(t,e)}}function s(e){return function(t){p[e]=t}}function d(e){if(r(v,e)){var t=v[e];delete v[e],R[e]=!0,u.apply(n,t)}if(!r(p,e)&&!r(R,e))throw new Error("No "+e);return p[e]}function c(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function f(e){return function(){return y&&y.config&&y.config[e]||{}}}var u,h,g,m,p={},v={},y={},R={},b=Object.prototype.hasOwnProperty,w=[].slice,_=/\.js$/;g=function(e,t){var i,n=c(e),r=n[0];return e=n[1],r&&(r=o(r,t),i=d(r)),r?e=i&&i.normalize?i.normalize(e,l(t)):o(e,t):(e=o(e,t),n=c(e),r=n[0],e=n[1],r&&(i=d(r))),{f:r?r+"!"+e:e,n:e,pr:r,p:i}},m={require:function(e){return a(e)},exports:function(e){var t=p[e];return void 0!==t?t:p[e]={}},module:function(e){return{id:e,uri:"",exports:p[e],config:f(e)}}},u=function(e,t,i,o){var l,c,f,u,h,y,b=[],w=typeof i;if(o=o||e,"undefined"===w||"function"===w){for(t=!t.length&&i.length?["require","exports","module"]:t,h=0;h()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,i="invalid-email";return Marionette.Object.extend({initialize:function(){this.listenTo(e,"change:modelValue",this.onChangeModelValue),this.listenTo(e,"keyup:field",this.emailKeyup),this.listenTo(e,"blur:field",this.onBlurField)},onChangeModelValue:function(e){var t=e.get("value"),i=e.get("id");this.emailChange(t,i)},onBlurField:function(e,t){var i=jQuery(e).val(),n=t.get("id");this.emailChange(i,n)},emailChange:function(e,n){if(0o){var l=nfRadio.channel("fields").request("get:field",t.get("id")),s=nfRadio.channel("app").request("get:form",l.get("formID"));nfRadio.channel("fields").request("add:error",t.get("id"),"number-max",s.get("settings").fieldNumberNumMaxError)}else nfRadio.channel("fields").request("remove:error",t.get("id"),"number-max");var d=Math.round(1e9*parseFloat(n)),c=Math.round(1e9*parseFloat(a));if(n&&0!=d%c){var l=nfRadio.channel("fields").request("get:field",t.get("id")),s=nfRadio.channel("app").request("get:form",l.get("formID"));nfRadio.channel("fields").request("add:error",t.get("id"),"number-step",s.get("settings").fieldNumberIncrementBy+a)}else nfRadio.channel("fields").request("remove:error",t.get("id"),"number-step")}})}),i("controllers/mirrorField",[],function(){var e=nfRadio.channel("fields");return Marionette.Object.extend({listeningModel:"",initialize:function(){this.listenTo(e,"init:model",this.registerMirror)},registerMirror:function(e){if(e.get("mirror_field")){this.listeningModel=e;var t=e.get("mirror_field");this.listenTo(nfRadio.channel("field-"+t),"change:modelValue",this.changeValue)}},changeValue:function(e){this.listeningModel.set("value",e.get("value")),this.listeningModel.trigger("reRender")}})}),i("controllers/confirmField",[],function(){var e=nfRadio.channel("fields"),t="confirm-mismatch";return Marionette.Object.extend({initialize:function(){this.listenTo(e,"init:model",this.registerConfirm),this.listenTo(e,"keyup:field",this.confirmKeyup)},registerConfirm:function(e){e.get("confirm_field")&&this.listenTo(nfRadio.channel("form"),"loaded",function(t){this.registerConfirmListeners(e)})},registerConfirmListeners:function(e){var t=nfRadio.channel("form-"+e.get("formID")).request("get:fieldByKey",e.get("confirm_field"));void 0!==t&&(t.set("confirm_with",e.get("id")),this.listenTo(nfRadio.channel("field-"+t.get("id")),"change:modelValue",this.changeValue),this.listenTo(nfRadio.channel("field-"+e.get("id")),"change:modelValue",this.changeValue))},changeValue:function(i){if(void 0===i.get("confirm_with"))var n=i,r=nfRadio.channel("form-"+i.get("formID")).request("get:fieldByKey",n.get("confirm_field"));else var r=i,n=e.request("get:field",r.get("confirm_with"));var o=(r.get("id"),n.get("id"));if(""==n.get("value")||n.get("value")==r.get("value"))nfRadio.channel("fields").request("remove:error",o,t);else{var a=nfRadio.channel("fields").request("get:field",o),l=nfRadio.channel("app").request("get:form",a.get("formID"));nfRadio.channel("fields").request("add:error",o,t,l.get("settings").confirmFieldErrorMsg)}},confirmKeyup:function(e,i,n){var r=jQuery(e).val();if(i.get("confirm_field"))var o=i,a=i.get("id"),l=nfRadio.channel("form-"+i.get("formID")).request("get:fieldByKey",o.get("confirm_field")),s=l.get("value"),d=r;else if(i.get("confirm_with"))var o=nfRadio.channel("fields").request("get:field",i.get("confirm_with")),a=o.get("id"),d=o.get("value"),s=d;if(void 0!==o)if(""==d)nfRadio.channel("fields").request("remove:error",a,t);else if(r==s)nfRadio.channel("fields").request("remove:error",a,t);else{var c=nfRadio.channel("fields").request("get:field",a),f=nfRadio.channel("app").request("get:form",c.get("formID"));nfRadio.channel("fields").request("add:error",a,t,f.get("settings").confirmFieldErrorMsg)}}})}),i("controllers/updateFieldModel",[],function(){return Marionette.Object.extend({initialize:function(){nfRadio.channel("nfAdmin").reply("update:field",this.updateField)},updateField:function(e,t){e.get("isUpdated")||(e.set("value",t),e.set("isUpdated",!0),_.isArray(t)&&e.trigger("change:value",e))}})}),i("controllers/submitButton",["controllers/submitButton"],function(e){return Marionette.Object.extend({bound:{},initialize:function(){this.listenTo(nfRadio.channel("submit"),"init:model",this.registerHandlers)},registerHandlers:function(e){if(void 0!==this.bound[e.get("id")])return!1;this.listenTo(nfRadio.channel("field-"+e.get("id")),"click:field",this.click,this),e.listenTo(nfRadio.channel("form-"+e.get("formID")),"before:submit",this.beforeSubmit,e),e.listenTo(nfRadio.channel("form-"+e.get("formID")),"submit:failed",this.resetLabel,e),e.listenTo(nfRadio.channel("form-"+e.get("formID")),"submit:response",this.resetLabel,e),e.listenTo(nfRadio.channel("form-"+e.get("formID")),"enable:submit",this.maybeEnable,e),e.listenTo(nfRadio.channel("form-"+e.get("formID")),"disable:submit",this.maybeDisable,e),e.listenTo(nfRadio.channel("form-"+e.get("formID")),"processingLabel",this.processingLabel,e),e.listenTo(nfRadio.channel("fields"),"add:error",this.maybeDisable,e),e.listenTo(nfRadio.channel("fields"),"remove:error",this.maybeEnable,e),this.bound[e.get("id")]=!0},click:function(e,t){var i=nfRadio.channel("app").request("get:form",t.get("formID"));nfRadio.channel("form-"+t.get("formID")).request("submit",i)},beforeSubmit:function(){this.set("disabled",!0),nfRadio.channel("form-"+this.get("formID")).trigger("processingLabel",this)},maybeDisable:function(e){void 0!==e&&e.get("formID")!=this.get("formID")||(this.set("disabled",!0),this.trigger("reRender"))},maybeEnable:function(e){if(void 0!==e&&e.get("formID")!=this.get("formID"))return!1;var t=nfRadio.channel("app").request("get:form",this.get("formID"));0==_.size(t.get("fieldErrors"))&&(this.set("disabled",!1),this.trigger("reRender"))},processingLabel:function(){if(this.get("label")==this.get("processing_label"))return!1;this.set("oldLabel",this.get("label")),this.set("label",this.get("processing_label")),this.trigger("reRender")},resetLabel:function(e){void 0!==this.get("oldLabel")&&this.set("label",this.get("oldLabel")),this.set("disabled",!1),this.trigger("reRender")}})}),i("controllers/submitDebug",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("forms"),"submit:response",this.submitDebug)},submitDebug:function(e,t,i,n){if(void 0!==e.debug){if(void 0!==e.debug.form){var r=document.createElement("span");_.each(e.debug.form,function(e,t){var i=document.createTextNode(e);r.appendChild(i),r.appendChild(document.createElement("br"))}),jQuery(".nf-debug-msg").html(r)}if(void 0!==e.debug.console){console.log("%c%s","","NINJA SUPPORT"),_.each(e.debug.console,function(e,t){console.log(e)}),console.log("%c%s","","END NINJA SUPPORT")}}}})}),i("controllers/getFormErrors",[],function(){nfRadio.channel("fields");return Marionette.Object.extend({initialize:function(e){nfRadio.channel("form").reply("get:errors",this.getFormErrors)},getFormErrors:function(e){var t=nfRadio.channel("app").request("get:form",e),i=!1;return t&&(0!==t.get("errors").length&&_.each(t.get("errors").models,function(e){i=i||{},i[e.get("id")]=e.get("msg")}),_.each(t.get("fields").models,function(e){"submit"!=e.get("type")&&e.get("errors").length>0&&(i=i||{},i[e.get("id")]=e.get("errors"))})),i}})}),i("controllers/validateRequired",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("fields"),"blur:field",this.validateRequired),this.listenTo(nfRadio.channel("fields"),"change:field",this.validateRequired),this.listenTo(nfRadio.channel("fields"),"keyup:field",this.validateKeyup),this.listenTo(nfRadio.channel("fields"),"change:modelValue",this.validateModelData),this.listenTo(nfRadio.channel("submit"),"validate:field",this.validateModelData)},validateKeyup:function(e,t,i){if(1!=t.get("required"))return!1;t.get("clean")||this.validateRequired(e,t)},validateRequired:function(e,t){if(1!=t.get("required")||!t.get("visible"))return!1;var i=jQuery(e).val(),n=nfRadio.channel(t.get("type")).request("validate:required",e,t),r=!0,o=t.get("mask");if(o&&(o=o.replace(/9/g,"_"),o=o.replace(/a/g,"_"),o=o.replace(/\*/g,"_")),o&&i===o&&00&&_.each(e.errors.fields,function(e,t){"object"==typeof e?nfRadio.channel("fields").request("add:error",t,e.slug,e.message):nfRadio.channel("fields").request("add:error",t,"required-error",e)}),_.size(e.errors.form)>0&&_.each(e.errors.form,function(e,t){nfRadio.channel("form-"+n).request("remove:error",t),nfRadio.channel("form-"+n).request("add:error",t,e)}),void 0!==e.errors.last&&void 0!==e.errors.last.message){var r="background: rgba(255, 207, 115, .5); color: #FFA700; display: block;";console.log("%c NINJA FORMS SUPPORT: SERVER ERROR",r),console.log(e.errors.last.message),console.log("%c END SERVER ERROR MESSAGE",r)}jQuery("#nf-form-"+n+"-cont .nf-field-container").show()}})}),i("controllers/actionRedirect",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("forms"),"submit:response",this.actionRedirect)},actionRedirect:function(e){void 0!==e.data.halt&&void 0!==e.data.halt.redirect&&""!=e.data.halt.redirect&&(window.location=e.data.halt.redirect),0==_.size(e.errors)&&void 0!==e.data.actions&&void 0!==e.data.actions.redirect&&""!=e.data.actions.redirect&&(window.location=e.data.actions.redirect)}})}),i("controllers/actionSuccess",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("forms"),"submit:response",this.actionSubmit)},actionSubmit:function(e){if(0==_.size(e.errors)&&void 0!==e.data.actions&&void 0!==e.data.actions.success_message&&""!=e.data.actions.success_message){
var t=e.data.form_id,i=jQuery("#nf-form-"+t+"-cont .nf-response-msg");i.html(e.data.actions.success_message).show();var n=i.offset().top,r=i.offset().top+i.outerHeight(),o=jQuery(window).scrollTop()+jQuery(window).height(),a=jQuery(window).scrollTop();o>r&&a(.*?)<\/span>/,"")+"}";n=n.replace(e,t)});var o=n.match(new RegExp(/{calc:(.*?)}/g));_.each(o,function(e){var r=e.replace("}","").replace("{calc:","").replace(":2",""),o=t.calcs[i.get("formID")].findWhere({name:r}),a=new RegExp(e,"g"),l=o.get("value");void 0!==l&&(l=t.applyLocaleFormatting(l)),n="html"===i.get("type")?n.replace(a,''+l+" "):l}),i.set("value",n),t.init[e.get("name")]||i.trigger("reRender"),t.init[e.get("name")]=!1})},getCalc:function(e,t){return this.calcs[t].findWhere({name:e})},changeCalc:function(e,t){var i=this.replaceAllKeys(e);i=i.replace("[","").replace("]",""),i=i.replace(/\r?\n|\r/g,"");try{e.set("value",Number(mexp.eval(i)).toFixed(e.get("dec")))}catch(e){console.log(e)}"NaN"===e.get("value")&&e.set("value","0")},applyLocaleFormatting:function(e){var t=e.split(".");if(t.length>1){t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,nfi18n.thousands_sep);var i=t.join(nfi18n.decimal_point)}else var i=e.replace(/\B(?=(\d{3})+(?!\d))/g,nfi18n.thousands_sep);return i}})}),i("controllers/fieldDate",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("date"),"render:view",this.initDatepicker)},initDatepicker:function(e){var t=e.model.get("date_format");""!=t&&"default"!=t||(t=this.convertDateFormat(nfi18n.dateFormat));var i=jQuery(e.el).find(".nf-element")[0],n=pikadayResponsive(i,{format:t,outputFormat:t,classes:jQuery(i).attr("class"),placeholder:e.model.get("placeholder"),pikadayOptions:{yearRange:this.getYearRange(e.model),minDate:this.getMinDate(e.model),maxDate:this.getMaxDate(e.model),firstDay:parseInt(nfi18n.startOfWeek)}});1==e.model.get("date_default")&&n.setDate(moment()),nfRadio.channel("pikaday").trigger("init",n,e.model)},getYearRange:function(e){var t=e.get("year_range_start"),i=e.get("year_range_end");return t&&i?[t,i]:t?(i=t+10,[t,i]):i?(t=i-10,[t,i]):10},getMinDate:function(e){var t=e.get("year_range_start");return t?new Date(t,0,1):null},getMaxDate:function(e){var t=e.get("year_range_end");return t?new Date(t,11,31):null},convertDateFormat:function(e){return e=e.replace("D","ddd"),e=e.replace("d","DD"),e=e.replace("l","dddd"),e=e.replace("j","D"),e=e.replace("N",""),e=e.replace("S",""),e=e.replace("w","d"),e=e.replace("z",""),e=e.replace("W","W"),e=e.replace("M","MMM"),e=e.replace("F","MMMM"),e=e.replace("m","MM"),e=e.replace("n","M"),e=e.replace("t",""),e=e.replace("L",""),e=e.replace("o","YYYY"),e=e.replace("Y","YYYY"),e=e.replace("y","YY"),e=e.replace("a",""),e=e.replace("A",""),e=e.replace("B",""),e=e.replace("g",""),e=e.replace("G",""),e=e.replace("h",""),e=e.replace("H",""),e=e.replace("i",""),e=e.replace("s",""),e=e.replace("u",""),e=e.replace("v",""),e=e.replace("e",""),e=e.replace("I",""),e=e.replace("O",""),e=e.replace("P",""),e=e.replace("T",""),e=e.replace("Z",""),e=e.replace("c",""),e=e.replace("r",""),e=e.replace("u","")}})}),i("controllers/fieldRecaptcha",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("recaptcha"),"init:model",this.initRecaptcha),this.listenTo(nfRadio.channel("forms"),"submit:response",this.resetRecaptcha)},initRecaptcha:function(e){nfRadio.channel("recaptcha").reply("update:response",this.updateResponse,this,e.id)},updateResponse:function(e,t){var i=nfRadio.channel("fields").request("get:field",t);i.set("value",e),nfRadio.channel("fields").request("remove:error",i.get("id"),"required-error")},resetRecaptcha:function(){var e=0;jQuery(".g-recaptcha").each(function(){try{grecaptcha.reset(e)}catch(e){console.log("Notice: Error trying to reset grecaptcha.")}e++})}})}),i("controllers/fieldHTML",[],function(){return Marionette.Object.extend({htmlFields:[],trackedMergeTags:[],initialize:function(){this.listenTo(Backbone.Radio.channel("fields-html"),"init:model",this.setupFieldMergeTagTracking)},setupFieldMergeTagTracking:function(e){this.htmlFields.push(e);var t=e.get("formID");this.listenTo(nfRadio.channel("form-"+t),"init:model",function(t){var i=e.get("default").match(new RegExp(/{field:(.*?)}/g));i&&(_.each(i,function(e){var i=e.replace("{field:","").replace("}",""),n=t.get("fields").findWhere({key:i});void 0!==n&&(this.trackedMergeTags.push(n),this.listenTo(nfRadio.channel("field-"+n.get("id")),"change:modelValue",this.updateFieldMergeTags))},this),this.updateFieldMergeTags())},this)},updateFieldMergeTags:function(e){_.each(this.htmlFields,function(e){var t=e.get("value");_.each(this.trackedMergeTags,function(e){var i=t.match(new RegExp(/'+e.get("value")+" ")},this),e.set("value",t),e.trigger("reRender")},this)}})}),i("controllers/helpText",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("form"),"render:view",this.initHelpText),nfRadio.channel("form").reply("init:help",this.initHelpText)},initHelpText:function(e){jQuery(e.el).find(".nf-help").each(function(){jQuery(this).jBox("Tooltip",{theme:"TooltipBorder",content:jQuery(this).data("text")})})}})}),i("controllers/fieldTextareaRTE",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("textarea"),"render:view",this.initTextareaRTEs),this.listenTo(nfRadio.channel("textarea"),"click:extra",this.clickExtra),this.meta_image_frame,this.currentContext={},void 0!==jQuery.summernote&&(jQuery.summernote.options.icons={align:"dashicons dashicons-editor-alignleft",alignCenter:"dashicons dashicons-editor-aligncenter",alignJustify:"dashicons dashicons-editor-justify",alignLeft:"dashicons dashicons-editor-alignleft",alignRight:"dashicons dashicons-editor-alignright",indent:"dashicons dashicons-editor-indent",outdent:"dashicons dashicons-editor-outdent",bold:"dashicons dashicons-editor-bold",caret:"dashicons dashicons-arrow-down",close:"dashicons dashicons-dismiss",code:"dashicons dashicons-editor-code",eraser:"dashicons dashicons-editor-removeformatting",italic:"dashicons dashicons-editor-italic",link:"dashicons dashicons-admin-links",unlink:"dashicons dashicons-editor-unlink",magic:"dashicons dashicons-editor-paragraph",minus:"dashicons dashicons-minus",orderedlist:"dashicons dashicons-editor-ol",redo:"dashicons dashicons-redo",square:"dashicons fa-square",table:"dashicons dashicons-editor-table",underline:"dashicons dashicons-editor-underline",undo:"dashicons dashicons-undo",unorderedlist:"dashicons dashicons-editor-ul"})},initTextareaRTEs:function(e){if(1!=e.model.get("textarea_rte"))return!1;var t=this,i=function(e){return t.linkButton(e)},n=function(e){return t.mediaButton(e)},r=[["paragraphStyle",["style"]],["fontStyle",["bold","italic","underline","clear"]],["lists",["ul","ol"]],["paragraph",["paragraph"]],["customGroup",["linkButton","unlink"]],["table",["table"]],["actions",["undo","redo"]]];1==e.model.get("textarea_media")&&0!=userSettings.uid&&r.push(["tools",["mediaButton"]]),jQuery(e.el).find(".nf-element").summernote({toolbar:r,buttons:{linkButton:i,mediaButton:n},height:150,codemirror:{theme:"monokai",lineNumbers:!0},prettifyHtml:!0,callbacks:{onChange:function(t){e.model.set("value",jQuery(this).summernote("code"))}}});var o=jQuery(e.el).find(".link-button").next(".dropdown-menu").find("button");o.replaceWith(function(){return jQuery("
",{class:jQuery(o).attr("class"),html:this.innerHTML})})},linkButton:function(e){var t=this,i=jQuery.summernote.ui,n=nfRadio.channel("app").request("get:template","#tmpl-nf-rte-link-button"),r=nfRadio.channel("app").request("get:template","#tmpl-nf-rte-link-dropdown");return i.buttonGroup([i.button({className:"dropdown-toggle link-button",contents:n({}),tooltip:nfi18n.fieldTextareaRTEInsertLink,click:function(i){t.clickLinkButton(i,e)},data:{toggle:"dropdown"}}),i.dropdown([i.buttonGroup({children:[i.button({contents:r({}),tooltip:""})]})])]).render()},mediaButton:function(e){var t=this,i=jQuery.summernote.ui,n=nfRadio.channel("app").request("get:template","#tmpl-nf-rte-media-button");return i.button({className:"dropdown-toggle",contents:n({}),tooltip:nfi18n.fieldTextareaRTEInsertMedia,click:function(i){t.openMediaManager(i,e)}}).render()},openMediaManager:function(e,t){if(t.invoke("editor.saveRange"),this.meta_image_frame)return void this.meta_image_frame.open();this.meta_image_frame=wp.media.frames.meta_image_frame=wp.media({title:nfi18n.fieldTextareaRTESelectAFile,button:{text:"insert"}});var i=this;this.meta_image_frame.on("select",function(){var e=i.meta_image_frame.state().get("selection").first().toJSON();i.insertMedia(e,t)}),this.meta_image_frame.open()},clickLinkButton:function(e,t){var i=t.invoke("editor.createRange");t.invoke("editor.saveRange");var n=i.toString();this.currentContext=t,jQuery(e.target).closest(".note-customGroup > .note-btn-group").on("hide.bs.dropdown",function(e){return!1}),jQuery(e.target).closest(".note-customGroup > .note-btn-group").on("shown.bs.dropdown",function(e){jQuery(e.target).parent().parent().find(".link-text").val(n),jQuery(e.target).parent().parent().find(".link-url").focus()})},clickExtra:function(e){var t=jQuery(e.target).parent().find(".link-text"),i=jQuery(e.target).parent().find(".link-url"),n=jQuery(e.target).parent().find(".link-new-window");if(this.currentContext.invoke("editor.restoreRange"),jQuery(e.target).hasClass("insert-link")){var r=t.val(),o=i.val(),a=!!n.prop("checked");0!=r.length&&0!=o.length&&this.currentContext.invoke("editor.createLink",{text:r,url:o,isNewWindow:a})}t.val(""),i.val(""),n.prop("checked",!1),jQuery(e.target).closest("div.note-btn-group.open").removeClass("open")},insertMedia:function(e,t){t.invoke("editor.restoreRange"),"image"==e.type?t.invoke("editor.insertImage",e.url):t.invoke("editor.createLink",{text:e.filename,url:e.url})}})}),i("controllers/fieldStarRating",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("starrating"),"init:model",this.register),this.listenTo(nfRadio.channel("starrating"),"render:view",this.initRating)},register:function(e){e.set("renderRatings",this.renderRatings)},initRating:function(e){jQuery(e.el).find(".starrating").rating()},renderRatings:function(){for(var e=document.createElement("span"),t=0;t<=this.number_of_stars-1;t++){var i=nfRadio.channel("app").request("get:template","#tmpl-nf-field-starrating-star"),n=t+1,r="";this.value==n&&(r="checked");var o=i({id:this.id,classes:this.classes,num:n,checked:r,required:this.required});e.appendChild(document.createRange().createContextualFragment(o))}return e.innerHTML}})}),i("controllers/fieldTerms",[],function(){return Marionette.Object.extend({initialize:function(){this.listenTo(nfRadio.channel("terms"),"init:model",this.register)},register:function(e){this.listenTo(nfRadio.channel("field-"+e.get("id")),"click:extra",this.clickExtra),this.listenTo(nfRadio.channel("field-"+e.get("id")),"keyup:field",this.keyUpExtra)},clickExtra:function(e,t){var i=jQuery(e.currentTarget),n=i.parent().find(".extra-value").val();this.addOption(t,n)},keyUpExtra:function(e,t,i){13==i&&this.addOption(t,e.val())},addOption:function(e,t){if(t){var i=e.get("options"),n={label:t,value:t,selected:0};i.push(n);e.get("value").push(t),e.trigger("reRender")}}})}),i("controllers/formContentFilters",[],function(){return Marionette.Object.extend({initialize:function(){this.viewFilters=[],this.loadFilters=[],nfRadio.channel("formContent").reply("add:viewFilter",this.addViewFilter,this),nfRadio.channel("formContent").reply("add:loadFilter",this.addLoadFilter,this),nfRadio.channel("formContent").reply("get:viewFilters",this.getViewFilters,this),nfRadio.channel("formContent").reply("get:loadFilters",this.getLoadFilters,this),nfRadio.channel("fieldContents").reply("add:viewFilter",this.addViewFilter,this),nfRadio.channel("fieldContents").reply("add:loadFilter",this.addLoadFilter,this),nfRadio.channel("fieldContents").reply("get:viewFilters",this.getViewFilters,this),nfRadio.channel("fieldContents").reply("get:loadFilters",this.getLoadFilters,this)},addViewFilter:function(e,t){this.viewFilters[t]=e},getViewFilters:function(){return this.viewFilters},addLoadFilter:function(e,t){this.loadFilters[t]=e},getLoadFilters:function(){return this.loadFilters}})}),i("views/fieldItem",[],function(){return Marionette.ItemView.extend({tagName:"div",initialize:function(){this.listenTo(this.model,"reRender",this.render,this),this.listenTo(this.model,"change:addWrapperClass",this.addWrapperClass,this),this.listenTo(this.model,"change:removeWrapperClass",this.removeWrapperClass,this),this.listenTo(this.model,"change:invalid",this.toggleAriaInvalid,this),this.template="#tmpl-nf-field-"+this.model.get("wrap_template")},test:function(e){console.log("firing from trigger 1")},addWrapperClass:function(){var e=this.model.get("addWrapperClass");""!=e&&(jQuery(this.el).addClass(e),this.model.set("addWrapperClass",""))},removeWrapperClass:function(){var e=this.model.get("removeWrapperClass");""!=e&&(jQuery(this.el).removeClass(e),this.model.set("removeWrapperClass",""))},toggleAriaInvalid:function(){var e=this.model.get("invalid");jQuery("[aria-invalid]",this.el).attr("aria-invalid",JSON.stringify(e))},onRender:function(){if(this.$el=this.$el.children(),this.$el.unwrap(),this.setElement(this.$el),void 0!==this.model.get("mask")&&""!=jQuery.trim(this.model.get("mask"))){if("custom"==this.model.get("mask"))var e=this.model.get("custom_mask");else var e=this.model.get("mask");if(Number.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},Number.isInteger(e)&&(e=e.toString()),"currency"==e){var t=nfRadio.channel("app").request("get:form",this.model.get("formID")),i=t.get("thousands_sep");" "==i&&(i=" ");var n=jQuery("
").html(t.get("currencySymbol")).text();i=jQuery("
").html(i).text();var r=jQuery("
").html(t.get("decimal_point")).text(),o={digitGroupSeparator:i,decimalCharacter:r,currencySymbol:n},a=jQuery(jQuery(this.el).find(".nf-element")[0]);new AutoNumeric(jQuery(this.el).find(".nf-element")[0],o);var l=this;a.on("change",function(e){l.model.set("value",e.target.value)})}else jQuery(this.el).find(".nf-element").mask(e)}nfRadio.channel(this.model.get("type")).trigger("render:view",this),nfRadio.channel("fields").trigger("render:view",this)},templateHelpers:function(){var e=this;return{renderElement:function(){var e=_.find(this.element_templates,function(e){if(0l&&jQuery(e).val(r.slice(0,l).join(" "))}this.render()},templateHelpers:function(){var e=this;return{currentCount:function(){return e.count}}}})}),i("views/afterField",["views/fieldErrorCollection","views/inputLimit"],function(e,t){return Marionette.ItemView.extend({tagName:"nf-section",template:"#tmpl-nf-field-after",initialize:function(){this.model.on("change:errors",this.changeError,this)},onRender:function(){var i=jQuery(this.el).children(".nf-error-wrap");if(this.errorCollectionView=new e({el:i,collection:this.model.get("errors"),fieldModel:this.model}),00&&(i=t.apply(this,[]));var n=t.apply(this,arguments);return arguments.length>0&&i!=t.apply(this,[])&&e(this).hasClass("nf-element")&&e(this).change(),n}}(jQuery),jQuery(document).ready(function(e){t(["models/formCollection","models/formModel","models/fieldCollection","controllers/loadControllers","views/mainLayout"],function(t,i,n,r,o){if("undefined"==typeof nfForms)return void jQuery(".nf-form-cont").empty();(new(Marionette.Application.extend({forms:{},initialize:function(e){var t=this;Marionette.Renderer.render=function(e,i){var e=t.template(e);return e(i)},this.getNonce(),this.urlParameters=_.object(_.compact(_.map(location.search.slice(1).split("&"),function(e){if(e)return e.split("=")}))),void 0!==this.urlParameters.nf_resume&&this.listenTo(nfRadio.channel("form-"+this.urlParameters.nf_resume),"loaded",this.restart);new r;nfRadio.channel("app").trigger("after:loadControllers"),nfRadio.channel("app").reply("get:template",this.template)},onStart:function(){var e=nfRadio.channel("app").request("get:forms");_.each(e.models,function(e,t){var i=new o({model:e,fieldCollection:e.get("fields")});nfRadio.channel("form").trigger("render:view",i),jQuery(document).trigger("nfFormReady",i)})},restart:function(e){if(void 0!==this.urlParameters.nf_resume){var t={action:"nf_ajax_submit",security:nfFrontEnd.ajaxNonce,nf_resume:this.urlParameters};nfRadio.channel("form-"+e.get("id")).trigger("disable:submit"),nfRadio.channel("form-"+e.get("id")).trigger("processingLabel"),this.listenTo(nfRadio.channel("form"),"render:view",function(){jQuery("#nf-form-"+e.get("id")+"-cont .nf-field-container:not(.submit-container)").hide()}),jQuery.ajax({url:nfFrontEnd.adminAjax,type:"POST",data:t,cache:!1,success:function(t,i,n){try{var r=t;nfRadio.channel("forms").trigger("submit:response",r,i,n,e.get("id")),nfRadio.channel("form-"+e.get("id")).trigger("submit:response",r,i,n)}catch(e){console.log("Parse Error")}},error:function(e,t,i){console.log("ERRORS: "+t),nfRadio.channel("forms").trigger("submit:response","error",t,e,i)}})}},getNonce:function(){var e={action:"nf_ajax_get_new_nonce"};jQuery.ajax({url:nfFrontEnd.adminAjax,type:"POST",data:e,cache:!1,success:function(e,t,i){try{e=JSON.parse(e);var n=e.data;nfFrontEnd.ajaxNonce=n.new_nonce,nfFrontEnd.nonce_ts=n.nonce_ts}catch(e){console.log("Parse Error")}},error:function(e,t,i){console.log("ERRORS: "+t)}})},template:function(t){return _.template(e(t).html(),{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g,variable:"data"})}}))).start()})}),i("main",function(){})}();